#pragma once
#include "logger.h"

/**
 *  单例模式
 * */
namespace singleshot
{
    struct TestA
    {
        void print()
        {
            common::Logger::output("TestA's print");
        }
    };

    struct TestB
    {
        void print()
        {
            common::Logger::output("TestB's print");
        }
    };
    template <class T>
    class CSingleShot
    {
    public:
        void print();
        static T *getInstance()
        {
            return &m_instance;
        }

    private:
        CSingleShot() {}
        ~CSingleShot() {}

    private:
        static T m_instance;
    };
    template <class T>
    T CSingleShot<T>::m_instance;

    template <class T>
    void CSingleShot<T>::print()
    {
        common::Logger::output("hello world");
    }
}